import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn } from 'typeorm'

@Entity('menus')
export class Menu {
  @PrimaryGeneratedColumn({ name: 'id' })
  public id: number

  @Column({ type: 'varchar', name: 'name', length: 100, comment: '名称' })
  public name: string

  @Column({ type: 'varchar', name: 'title', length: 100, comment: '标题' })
  public title: string

  @Column()
  public pid: number

  @Column({ type: 'varchar', length: 100, comment: '图标', default: '' })
  public icon: string

  @Column({ type: 'varchar', length: 100, comment: '路径', default: '' })
  public path: string

  @Column({ type: 'varchar', length: 100, comment: '组件', default: '' })
  public component: string

  @Column({ type: 'boolean', comment: '是否固定' })
  public affix: boolean

  @Column({ type: 'varchar', length: 256, comment: '权限名称', default: '' })
  public roles: string

  @Column({ type: 'varchar', length: 100, comment: '权限名称', default: '' })
  redirect: string

  @CreateDateColumn({ type: 'timestamp', name: 'create_date', comment: '创建时间' })
  createDate: Date

  @CreateDateColumn({ type: 'timestamp', name: 'update_date', comment: '创建时间' })
  updateDate: Date
}
